import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2022-08-05
 * Time: 15:06
 */

class Data {

    private int x;
    private int y;

    public Data(int x, int y) {
        //this. 指明对象
        this.x = x;  //为用tihis.限定之前，为0
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
}

class Test {
    public String toString() {
        System.out.print("aaa");
        return "bbb";
    }
}

class Person {
    private int age;
    //由于age由private 修饰 只能在类得内部修改

    public int getAge() {
        if (this.age > 200) {
            return 200;
        } else if (this.age < 0) {
            return 0;
        } else {
            return this.age;
        }
    }

    public void setAge(int age) {
        this.age = age;//年龄得初始化设置
    }
}

public class Test_0804 {

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            Data data = new Data(x, y);
            System.out.println(data.getX() + data.getY());
        }
    }

    public static void main2(String[] args) {
        Test test = new Test();
        System.out.println(test);
    }

    public static void main(String[] args) {
        //采用封装的思想，为Person类定义年龄属性
        Person p = new Person();
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int age = scanner.nextInt();
            p.setAge(age);
            System.out.println(p.getAge());
        }
    }
}





